/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DAL_CONDITION_H_
#define _DAL_CONDITION_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "dal/base_type.h"
#include "dal/status.h"
#include "dal/dal_string.h"
#include "dal/string_sequence.h"

// GUARD CONDITION
typedef struct dal_guard_condition_s
{
    void* handle_;
} dal_guard_condition_t;

dal_ret_t dal_guard_condition_set_trigger_value(dal_guard_condition_t* gc, BOOLEAN value);

// STATUS CONDITION
typedef struct dal_status_condition_s
{
    void* handle_;
} dal_status_condition_t;

dal_status_mask_t dal_status_condition_get_enabled_statuses(dal_status_condition_t* sc);
dal_ret_t dal_status_condition_set_enabled_statuses(dal_status_condition_t* sc,
                                                    dal_status_mask_t mask);

// READ CONDITION
typedef struct dal_read_condition_s
{
    void* handle_;
} dal_read_condition_t;

dal_sample_state_mask_t dal_read_condition_get_sample_state_mask(dal_read_condition_t* rc);
dal_view_state_mask_t dal_read_condition_get_view_state_mask(dal_read_condition_t* rc);
dal_instance_mask_t dal_read_condition_get_instance_state_mask(dal_read_condition_t* rc);
dal_datareader_t* dal_read_condition_get_datareader(dal_read_condition_t* rc);

typedef struct dal_query_condition_s
{
    void* handle_;
} dal_query_condition_t;

dal_string_t* get_query_expression(dal_query_condition_t* qc);
dal_ret_t get_query_parameters(dal_query_condition_t* qc, dal_stringseq_t* query_parameters);
dal_ret_t set_query_parameters(dal_query_condition_t* qc, dal_stringseq_t* query_parameters);

#ifdef __cplusplus
}
#endif

#endif  // _DAL_CONDITION_H_
